// 异步模式演示
import React, { useEffect } from 'react';

function async() {
  console.log('global begin');

  setTimeout(function timmer1() {
    console.log('timer1 invoke');
  }, 1800);

  setTimeout(function timer2() {
    console.log('timer2 invoke');

    setTimeout(function inner() {
      console.log('inner invoke');
    }, 1000);
  }, 1000);

  console.log('global end');
}

export default function Async() {
  useEffect(async, null);

  return (
    <div>
      <p>同步执行</p>
    </div>
  );
}
